# $Id$
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

pkgbase=plasma-desktop
pkgname=(plasma-desktop knetattach)
pkgver=5.10.5
pkgrel=1
pkgdesc='KDE Plasma Desktop'
arch=('i686' 'x86_64')
url='https://www.kde.org/workspaces/plasmadesktop/'
license=('LGPL')
source=("https://download.kde.org/stable/plasma/$pkgver/$pkgname-$pkgver.tar.xz"{,.sig})
depends=('polkit-kde-agent' 'libcanberra' 'libxkbfile' 'kmenuedit' 'appstream-qt'
         'systemsettings' 'ksysguard' 'kpeople' 'baloo' 'qt5-graphicaleffects' 'kactivities-stats')
makedepends=('extra-cmake-modules' 'kdoctools' 'boost' 'xf86-input-evdev' 'xf86-input-synaptics' 'xorg-server-devel'
             'libibus' 'scim' 'python' 'kdesignerplugin')
groups=('plasma')
sha256sums=('15bfd43b9589654f1c8c56601fc392a1a16f07b2979ae1d92d4f9570c514beeb'
            'SKIP')
validpgpkeys=('2D1D5B0588357787DE9EE225EC94D18F7F05997E'  # Jonathan Riddell
              '348C8651206633FD983A8FC4DEACEA00075E1D76'  # KDE Neon
              'D07BD8662C56CB291B316EB2F5675605C74E02CF') # David Edmundson

prepare() {
  mkdir -p build
}

build() {
  cd build
  cmake ../$pkgname-$pkgver \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DKDE_INSTALL_LIBDIR=lib \
    -DKDE_INSTALL_LIBEXECDIR=lib \
    -DBUILD_TESTING=OFF
  make
}

package_plasma-desktop() {
  depends+=(knetattach)
  optdepends=('plasma-nm: Network manager applet'
            'powerdevil: power management'
            'ibus: kimpanel IBUS support'
            'scim: kimpanel SCIM support'
            'discover: manage applications installation from the launcher')
  conflicts=('kdebase-workspace' 'kcm-touchpad-frameworks' 'kdeplasma-addons<5.5.95' 'kactivities<5.19.0-3')
  replaces=('kcm-touchpad-frameworks')

  cd build
  make DESTDIR="$pkgdir" install

# Split knetattach
  rm "$pkgdir"/usr/{bin/knetattach,share/applications/org.kde.knetattach.desktop}
}

package_knetattach() {
  pkgdesc='Wizard which makes it easier to integrate network resources with the Plasma Desktop'
  depends=(kdelibs4support)

  cd build/knetattach
  make DESTDIR="$pkgdir" install
}
